#ifndef __HIKARI_navmeshTry___FILE__DEFINED
#define __HIKARI_navmeshTry___FILE__DEFINED

#include "hikari.h"

class navmeshTry:public BaseHikariScript{
public:
//PLEASE DO NOT MODIFY THIS SECTION
//PROPERTIES_SECTION_START
//PROPERTIES_SECTION_END
	NavmeshPath*path;
	irr::gui::IGUIStaticText*text;
    virtual void sceneLoaded(HObj*object, HikariContext*context){
		text=context->getGuiManager()->addStaticText(L"",recti(10,50,300,60));
		path=context->getNavmeshManager()->generatePath(object->getPosition(),vector3df(17.72f,0.0f,-47));
		vector3df p=object->getPosition();
		path->nextPathPoint(p,1.0f);
		object->setPosition(p);
	}
	//virtual void sceneUnloading(HObj*object, HikariContext*context){}
	virtual void update(HObj*object, HikariContext*context){
		if(path!=NULL){
			vector3df p=object->getPosition();
			if(path->nextPathPoint(p,1.0f)){
				object->setPosition(p);
			}else{
				path=NULL;
			}
		}
		wchar_t buffer[1000];
		vector3df p=object->getPosition();
		swprintf(buffer,L"X=%.2f Y=%.2f Z=%.2f", p.X, p.Y, p.Z);
		text->setText(buffer);
	}

	IMPLEMENT_RTTI(navmeshTry, BaseHikariScript);
    
};
BEGIN_REFLECTION_METADATA(navmeshTry, base_rtti_object)
END_REFLECTION_METADATA(navmeshTry)
#endif